package com.maple.controller;

import com.maple.pojo.Customer;
import com.maple.pojo.User;
import com.maple.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class CustomerController {
    @Autowired
    CustomerService customerService;
    @RequestMapping("/yud")
    public String yud(@RequestParam("cname") String cname,
                      @RequestParam("identity_num") String identity_num,
                      @RequestParam("tel_phone") String tel_phone,
                      @RequestParam("start_time") String start_time,
                      @RequestParam("end_time") String end_time,
                      @RequestParam("room_type") String room_type,
                      @RequestParam("message") String message){

        Customer customer = new Customer();
        customer.setCname(cname);
        customer.setIdentity_num(identity_num);
        customer.setTel_phone(tel_phone);
        customer.setStart_time(start_time);
        customer.setEnd_time(end_time);
        customer.setRoom_type(room_type);
        customer.setMessage(message);
        customer.setPay_status("已支付");
        customer.setState(0);
        customer.setDeleted(0);
        boolean flag = customerService.cus(customer);
        if(flag==true){
            return "index";
        }else{
            return "oneing";
        }
    }
}
